package sg.edu.nus.iss.billing.gui;

//Tan Pic Cheng

import java.awt.Dimension;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import sg.edu.nus.iss.billing.entity.Customer;
import sg.edu.nus.iss.billing.localization.MessageKeyManager;

public class ViewCustomerContactPanel extends JPanel {
	/**
	 * 
	 */
private static final long serialVersionUID = 5344123593117689366L;

private String[] labelContent = {MessageKeyManager.getMessage("label.homeNo"), MessageKeyManager.getMessage("label.custMobileNo"), MessageKeyManager.getMessage("label.officeNo")};
	
	private JLabel lblCustHeader;
	private JLabel lblHome;
	private JLabel lblMobile;
	private JLabel lblOffice;
	
	private JLabel lblShowCustHome;
	private JLabel lblShowCustMobile;
	private JLabel lblShowCustOffice;
	
	private Customer customer;
	
	private int labelHeight = 20;
	private int labelWidth = 200;
	private int fieldControlX = 150;
	private int lblControlX = 10; 
	
	public ViewCustomerContactPanel(Customer customer) {
		// TODO Auto-generated constructor stub
		super();
		init();
		this.customer = customer;		
		lblShowCustHome.setText(customer.getContactNumber1());
		lblShowCustMobile.setText(customer.getContactNumber2());
		lblShowCustOffice.setText(customer.getContactNumber3());		
		
	}
	private JLabel createLabel(String labelContents, int x, int y){
		
		JLabel labelName = new JLabel(labelContents);
		labelName.setVerticalTextPosition(SwingConstants.BOTTOM);
		labelName.setBounds(x, y, labelWidth, labelHeight);
		add(labelName);
		
		return labelName;		
		
	}
	private void init() {
		// TODO Auto-generated method stub
		setLayout(null);
		setPreferredSize(new Dimension(400,300));
		setBounds(0, 400, 400, 300);
		
		lblCustHeader = createLabel("Customer Contact Details:", 10, 5);
		
		int controly = 40;
		
		for(int i = 0; i < labelContent.length; i++){
			
			switch(i){
			case 0: lblHome = createLabel(labelContent[i], lblControlX, controly);
					lblShowCustHome = createLabel("", fieldControlX, controly);
					break;
			case 1: lblMobile = createLabel(labelContent[i], lblControlX, controly);
					lblShowCustMobile = createLabel("", fieldControlX, controly);
					break;	
			case 2: lblOffice = createLabel(labelContent[i], lblControlX, controly);
					lblShowCustOffice = createLabel("", fieldControlX, controly);
					break;	
			default: break;
			}//End of Switch			
			controly = controly + 35;			
		}//End of for
			
	}
	

}
